<template>
  <tbody>
    <tr v-for="item in list" :key="item.id">
      <th>
        <input
          type="checkbox"
          :checked="item.checked"
          @change="changefn($event, item.id)"
        />
      </th>
      <th>{{ item.name }}</th>
      <th>{{ item.price }}</th>
      <th>
        <button @click="changeCount(-1,item.id)" :disabled="item.num<=1">-</button>
        <span> {{ item.num }}</span>
        <button @click="changeCount(+1,item.id)">+</button>
      </th>
      <th>{{ (item.price * item.num).toFixed(2) }}</th>
      <th>删除</th>
    </tr>
  </tbody>
</template>

<script>
export default {
  name: "DEV",
  props: {
    list: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {};
  },
  computed: {},
  created() {},
  mounted() {},
  watch: {},
  methods: {
    changefn(e, id) {
      // console.log(e.target.checked);
      // console.log(id);
      this.$emit("notiFather", e.target.checked, id);
    },
    changeCount(num,id){
this.$emit("changeCountfn", num, id);
    }
  },
  components: {},
};
</script>

<style scoped lang="scss"></style>
